The rapid growth of e-commerce has increased the importance of accurate sales forecasting and personalized product recommendations in data-driven business applications. This paper presents Time Series Based E-commerce Sales Forecasting and Intelligent Recommendation System, a web-based application that integrates machine learning-based sales forecasting with intelligent product recommendation techniques. The forecasting component uses the XGBoost Regressor to predict future daily sales based on historical sales data and engineered temporal features, including lag values, rolling statistics, and calendar-based attributes. The recommendation component implements three independent approaches: K-Nearest Neighbors (KNN)-based collaborative filtering for frequently bought products, content-based filtering using TF-IDF and cosine similarity for identifying similar products, and popularity-based ranking for recommending top-selling products within a selected department. The application is developed using React.js for the frontend and FastAPI for the backend, providing an interactive interface for accessing forecasts and generating product recommendations. MongoDB Atlas is used exclusively for user authentication data, while forecasting and recommendation datasets and model artifacts are maintained separately. The system combines predictive analytics and recommendation techniques within a single web application, providing users with an integrated platform for exploring future sales trends and product suggestions.
Introduction
The text presents a Time Series-Based E-commerce Sales Forecasting and Intelligent Recommendation System, a web-based application that uses machine learning to predict future sales and recommend relevant products. The system aims to help businesses understand sales trends, support data-driven decisions, and improve product discovery for customers.
1. Sales Forecasting Using XGBoost
Sales forecasting helps e-commerce businesses estimate future demand using historical sales data. The proposed system uses the XGBoost Regressor to predict daily sales based on 26 input features, including:
Historical sales values (lag features).
Rolling and expanding statistical measures.
Calendar-based attributes.
The Brazilian E-Commerce Public Dataset by Olist is used for forecasting. The data is aggregated into daily sales records, missing dates are included, and missing numerical values are filled with zeros.
The dataset is divided into 534 training records and 134 testing records. The trained model generates future sales predictions recursively, using earlier predictions to calculate features for subsequent days. Performance is evaluated using Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), Mean Absolute Percentage Error (MAPE), and the coefficient of determination (R²).
2. Intelligent Product Recommendation
The system incorporates three independent recommendation techniques using the Instacart dataset.
Frequently Bought Products: Item-based collaborative filtering uses K-Nearest Neighbors (KNN) and cosine distance to identify products associated with similar purchasing patterns.
Similar Products: Content-based filtering uses TF-IDF and cosine similarity to recommend products with similar names, aisles, and departmental information.
Top-Selling Products: Popularity-based ranking identifies popular products within a selected department using purchase counts and the number of unique customers.
These methods provide different ways to discover products based on customer purchasing behaviour, product characteristics, and popularity.
3. System Architecture and Technologies
The application follows a client–server architecture with the following components:
React.js: Provides the interactive frontend and user interface.
FastAPI and Python: Handle backend requests and machine learning operations.
XGBoost: Generates daily sales forecasts.
KNN, TF-IDF, and cosine similarity: Support product recommendation.
MongoDB Atlas: Stores user authentication information.
Plotly and Matplotlib: Support data visualization.
The forecasting and recommendation datasets, trained models, and generated outputs are maintained separately from MongoDB Atlas. This separation keeps authentication data distinct from machine learning resources.
4. Implementation and Workflow
The system operates through the following process:
Collect and preprocess the Olist and Instacart datasets.
Engineer temporal features and train the XGBoost forecasting model.
Develop the three product recommendation methods.
Integrate forecasting and recommendation services into the FastAPI backend.
Connect the backend to the React.js frontend.
Display future sales predictions, analytics, and product recommendations through an interactive web interface.
Users can request sales forecasts, explore visual analytics, search for products, and choose a recommendation method.
5. Research Contribution
Existing research explores various forecasting techniques, including ARIMA, SARIMA, Prophet, deep learning, and hybrid models. However, this project focuses on integrating an XGBoost-based forecasting model and multiple product recommendation methods into a single web application.
Conclusion
The project, Time Series Based E-commerce Sales Forecasting and Intelligent Recommendation System, presents a web-based application that integrates machine learning-based sales forecasting with intelligent product recommendations. An XGBoost Regressor is used to forecast daily e-commerce sales using historical sales data and engineered temporal features. The system also implements three independent recommendation techniques: item-based collaborative filtering for frequently bought products, content-based filtering for similar products, and popularity-based ranking for top-selling products within a department.
The forecasting model is evaluated using MAE, RMSE, MAPE, and (R^2), while the web application presents forecasting results, sales analytics, and product recommendations through a React.js frontend connected to a FastAPI backend. MongoDB Atlas is used exclusively for user authentication data, while datasets, model artifacts, and generated outputs are maintained separately. The integration of these components provides a unified interface for accessing sales forecasts and different product recommendation options. Future work may explore additional forecasting techniques, comparisons across different model configurations, and the incorporation of further temporal or external factors where suitable data is available. Recommendation functionality could be extended through additional personalization techniques and more comprehensive evaluation using recommendation-specific metrics. The application could also be enhanced with larger datasets and further performance and usability evaluation.
References
[1] P. G. Giannopoulos, T. K. Dasaklis, I. Tsantilas, and C. Patsakis, “Machine Learning Algorithms in Intermittent Demand Forecasting: A Review,” 2025.
[2] B. Wang and A. B. M. Zain, “A Hybrid XGBoost-LSTM Framework for Supply Chain Demand Forecasting: Empirical Evidence from Retail Multi-Store Data,” 2025.
[3] Z. Mohammed, C. Anas, and M. El Hammoumi, “A Hybrid Learning Framework for Forecasting Uncertainty and Adaptive Inventory Planning in Retail Supply Chains,” 2026.
[4] S. Mansur, K. Sattar, S. E. Hosseini, S. Pervez, I. Ahmad, K. Saleem, and A. Z. Elhendi, “Sales Forecasting for Retail Stores Using Hybrid Neural Networks and Sales-Affecting Variables,” 2025.
[5] P. Yadav and C. R. Barde, “Retail Real-Time Sales Prediction System Using LSTM and XGBoost,” 2025.
[6] C. Wang and J. Wang, “Research on E-Commerce Inventory Sales Forecasting Model Based on ARIMA and LSTM Algorithm,” 2025.
[7] H. Jatte, S. Belattar, and E. K. Haimoudi, “Optimization of Forecasting Performance in the Retail Sector Using Artificial Intelligence,” 2025.
[8] K. Douaioui, R. Oucheikh, O. Benmoussa, and C. Mabrouki, “Machine Learning and Deep Learning Models for Demand Forecasting in Supply Chain Management: A Critical Review,” 2024.
[9] T. Zhou, “Improved Sales Forecasting using Trend and Seasonality Decomposition with LightGBM,” 2023.
[10] Y. Chen, X. Xie, Z. Pei, W. Yi, C. Wang, W. Zhang, and Z. Ji, “Development of a Time Series E-Commerce Sales Prediction Method for Short-Shelf-Life Products Using GRU-LightGBM,” 2024.
[11] S. B. Kwarteng and P. A. Andreevich, “Comparative Analysis of ARIMA, SARIMA and Prophet Model in Forecasting,” 2024.
[12] I. Boukrouh, S. Idriri, F. Tayalati, A. Azmani, and L. Bouhassien, “A Hybrid Approach for Sales Forecasting: Combining Deep Learning and Time Series Analysis,” 2025.
[13] V. I. Kontopoulou, A. D. Panagopoulos, I. Kakkos, and G. K. Matsopoulos, “A Review of ARIMA vs. Machine Learning Approaches for Time Series Forecasting in Data-Driven Networks,” 2023.